package com.netease.pris.activity;

import android.os.Handler;
import android.os.Message;
import com.netease.g.b;
import com.netease.update.c;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InterruptedIOException;
import java.net.SocketTimeoutException;
import org.apache.http.NoHttpResponseException;
import org.apache.http.conn.ConnectTimeoutException;

class da extends Thread
{
  private static final int h = 1024;
  private String b;
  private String c;
  private long d;
  private long e;
  private String f;
  private boolean g;

  da(PRISActivityUpdate paramPRISActivityUpdate, String paramString1, String paramString2, String paramString3, long paramLong1, long paramLong2)
  {
    this.b = paramString1;
    this.c = paramString2;
    this.d = paramLong1;
    this.e = paramLong2;
    this.f = paramString3;
    this.g = false;
  }

  private void a(long paramLong1, long paramLong2)
  {
    if ((paramLong1 < 0L) || (paramLong2 < 0L))
      b.d(PRISActivityUpdate.c(), "initializeProgressDialog: invalid input");
    while (true)
    {
      return;
      PRISActivityUpdate.c(this.a, (int)(100L * paramLong2 / paramLong1));
    }
  }

  // ERROR //
  boolean a(String paramString, BufferedInputStream paramBufferedInputStream, long paramLong1, long paramLong2)
  {
    // Byte code:
    //   0: aload_1
    //   1: invokestatic 70	android/text/TextUtils:isEmpty	(Ljava/lang/CharSequence;)Z
    //   4: ifne +20 -> 24
    //   7: aload_2
    //   8: ifnull +16 -> 24
    //   11: lload_3
    //   12: lconst_0
    //   13: lcmp
    //   14: iflt +10 -> 24
    //   17: lload 5
    //   19: lconst_0
    //   20: lcmp
    //   21: ifge +9 -> 30
    //   24: iconst_0
    //   25: istore 7
    //   27: iload 7
    //   29: ireturn
    //   30: new 72	java/io/File
    //   33: dup
    //   34: aload_1
    //   35: iconst_0
    //   36: iconst_1
    //   37: aload_1
    //   38: ldc 74
    //   40: invokevirtual 80	java/lang/String:lastIndexOf	(Ljava/lang/String;)I
    //   43: iadd
    //   44: invokevirtual 84	java/lang/String:substring	(II)Ljava/lang/String;
    //   47: invokespecial 87	java/io/File:<init>	(Ljava/lang/String;)V
    //   50: astore 8
    //   52: aload 8
    //   54: invokevirtual 91	java/io/File:exists	()Z
    //   57: ifne +9 -> 66
    //   60: aload 8
    //   62: invokevirtual 94	java/io/File:mkdirs	()Z
    //   65: pop
    //   66: new 72	java/io/File
    //   69: dup
    //   70: aload_1
    //   71: invokespecial 87	java/io/File:<init>	(Ljava/lang/String;)V
    //   74: astore 9
    //   76: iconst_1
    //   77: istore 7
    //   79: new 96	java/io/RandomAccessFile
    //   82: dup
    //   83: aload_1
    //   84: ldc 98
    //   86: invokespecial 100	java/io/RandomAccessFile:<init>	(Ljava/lang/String;Ljava/lang/String;)V
    //   89: astore 10
    //   91: aload 10
    //   93: aload 9
    //   95: invokevirtual 104	java/io/File:length	()J
    //   98: invokevirtual 108	java/io/RandomAccessFile:seek	(J)V
    //   101: sipush 1024
    //   104: newarray byte
    //   106: astore 11
    //   108: iconst_0
    //   109: istore 12
    //   111: iconst_0
    //   112: istore 13
    //   114: lload_3
    //   115: ldc2_w 109
    //   118: ldiv
    //   119: lstore 14
    //   121: aload_0
    //   122: getfield 37	com/netease/pris/activity/da:g	Z
    //   125: ifne +300 -> 425
    //   128: aload_2
    //   129: aload 11
    //   131: iconst_0
    //   132: sipush 1024
    //   135: invokevirtual 116	java/io/BufferedInputStream:read	([BII)I
    //   138: istore 22
    //   140: iload 22
    //   142: ifle +283 -> 425
    //   145: aload 10
    //   147: aload 11
    //   149: iconst_0
    //   150: iload 22
    //   152: invokevirtual 120	java/io/RandomAccessFile:write	([BII)V
    //   155: iload 12
    //   157: iload 22
    //   159: iadd
    //   160: istore 12
    //   162: iload 12
    //   164: iload 13
    //   166: isub
    //   167: i2l
    //   168: lload 14
    //   170: lcmp
    //   171: iflt +146 -> 317
    //   174: invokestatic 122	com/netease/pris/activity/PRISActivityUpdate:a	()Z
    //   177: ifeq +64 -> 241
    //   180: aload_0
    //   181: getfield 22	com/netease/pris/activity/da:a	Lcom/netease/pris/activity/PRISActivityUpdate;
    //   184: lload 5
    //   186: iload 12
    //   188: i2l
    //   189: ladd
    //   190: l2i
    //   191: lload_3
    //   192: l2i
    //   193: invokestatic 125	com/netease/pris/activity/PRISActivityUpdate:a	(Lcom/netease/pris/activity/PRISActivityUpdate;II)V
    //   196: iload 12
    //   198: istore 13
    //   200: goto -79 -> 121
    //   203: astore 23
    //   205: invokestatic 43	com/netease/pris/activity/PRISActivityUpdate:c	()Ljava/lang/String;
    //   208: new 127	java/lang/StringBuilder
    //   211: dup
    //   212: invokespecial 128	java/lang/StringBuilder:<init>	()V
    //   215: ldc 130
    //   217: invokevirtual 134	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   220: aload_1
    //   221: invokevirtual 134	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   224: invokevirtual 137	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   227: invokestatic 50	com/netease/g/b:d	(Ljava/lang/String;Ljava/lang/String;)V
    //   230: aload 23
    //   232: invokevirtual 140	java/lang/SecurityException:printStackTrace	()V
    //   235: iconst_0
    //   236: istore 7
    //   238: goto -211 -> 27
    //   241: aload_0
    //   242: getfield 22	com/netease/pris/activity/da:a	Lcom/netease/pris/activity/PRISActivityUpdate;
    //   245: ldc2_w 51
    //   248: lload 5
    //   250: iload 12
    //   252: i2l
    //   253: ladd
    //   254: lmul
    //   255: lload_3
    //   256: ldiv
    //   257: l2i
    //   258: invokestatic 55	com/netease/pris/activity/PRISActivityUpdate:c	(Lcom/netease/pris/activity/PRISActivityUpdate;I)V
    //   261: goto -65 -> 196
    //   264: astore 19
    //   266: invokestatic 43	com/netease/pris/activity/PRISActivityUpdate:c	()Ljava/lang/String;
    //   269: new 127	java/lang/StringBuilder
    //   272: dup
    //   273: invokespecial 128	java/lang/StringBuilder:<init>	()V
    //   276: ldc 142
    //   278: invokevirtual 134	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   281: aload_1
    //   282: invokevirtual 134	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   285: invokevirtual 137	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   288: invokestatic 50	com/netease/g/b:d	(Ljava/lang/String;Ljava/lang/String;)V
    //   291: iconst_0
    //   292: istore 7
    //   294: aload 10
    //   296: ifnull -269 -> 27
    //   299: aload 10
    //   301: invokevirtual 145	java/io/RandomAccessFile:close	()V
    //   304: goto -277 -> 27
    //   307: astore 20
    //   309: aload 20
    //   311: invokevirtual 146	java/lang/Exception:printStackTrace	()V
    //   314: goto -287 -> 27
    //   317: lload 5
    //   319: iload 12
    //   321: i2l
    //   322: ladd
    //   323: lload_3
    //   324: lcmp
    //   325: ifne -204 -> 121
    //   328: invokestatic 122	com/netease/pris/activity/PRISActivityUpdate:a	()Z
    //   331: ifeq +71 -> 402
    //   334: aload_0
    //   335: getfield 22	com/netease/pris/activity/da:a	Lcom/netease/pris/activity/PRISActivityUpdate;
    //   338: lload 5
    //   340: iload 12
    //   342: i2l
    //   343: ladd
    //   344: l2i
    //   345: lload_3
    //   346: l2i
    //   347: invokestatic 125	com/netease/pris/activity/PRISActivityUpdate:a	(Lcom/netease/pris/activity/PRISActivityUpdate;II)V
    //   350: goto -229 -> 121
    //   353: astore 18
    //   355: invokestatic 43	com/netease/pris/activity/PRISActivityUpdate:c	()Ljava/lang/String;
    //   358: new 127	java/lang/StringBuilder
    //   361: dup
    //   362: invokespecial 128	java/lang/StringBuilder:<init>	()V
    //   365: ldc 148
    //   367: invokevirtual 134	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   370: aload 18
    //   372: invokevirtual 151	java/io/IOException:getMessage	()Ljava/lang/String;
    //   375: invokevirtual 134	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   378: invokevirtual 137	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   381: invokestatic 50	com/netease/g/b:d	(Ljava/lang/String;Ljava/lang/String;)V
    //   384: aload 18
    //   386: athrow
    //   387: astore 16
    //   389: aload 10
    //   391: ifnull +8 -> 399
    //   394: aload 10
    //   396: invokevirtual 145	java/io/RandomAccessFile:close	()V
    //   399: aload 16
    //   401: athrow
    //   402: aload_0
    //   403: getfield 22	com/netease/pris/activity/da:a	Lcom/netease/pris/activity/PRISActivityUpdate;
    //   406: ldc2_w 51
    //   409: lload 5
    //   411: iload 12
    //   413: i2l
    //   414: ladd
    //   415: lmul
    //   416: lload_3
    //   417: ldiv
    //   418: l2i
    //   419: invokestatic 55	com/netease/pris/activity/PRISActivityUpdate:c	(Lcom/netease/pris/activity/PRISActivityUpdate;I)V
    //   422: goto -301 -> 121
    //   425: invokestatic 153	com/netease/pris/activity/PRISActivityUpdate:b	()Z
    //   428: ifeq +29 -> 457
    //   431: invokestatic 43	com/netease/pris/activity/PRISActivityUpdate:c	()Ljava/lang/String;
    //   434: new 127	java/lang/StringBuilder
    //   437: dup
    //   438: invokespecial 128	java/lang/StringBuilder:<init>	()V
    //   441: ldc 155
    //   443: invokevirtual 134	java/lang/StringBuilder:append	(Ljava/lang/String;)Ljava/lang/StringBuilder;
    //   446: iload 12
    //   448: invokevirtual 158	java/lang/StringBuilder:append	(I)Ljava/lang/StringBuilder;
    //   451: invokevirtual 137	java/lang/StringBuilder:toString	()Ljava/lang/String;
    //   454: invokestatic 160	com/netease/g/b:e	(Ljava/lang/String;Ljava/lang/String;)V
    //   457: aload 10
    //   459: ifnull -432 -> 27
    //   462: aload 10
    //   464: invokevirtual 145	java/io/RandomAccessFile:close	()V
    //   467: goto -440 -> 27
    //   470: astore 21
    //   472: aload 21
    //   474: invokevirtual 146	java/lang/Exception:printStackTrace	()V
    //   477: goto -450 -> 27
    //   480: astore 17
    //   482: aload 17
    //   484: invokevirtual 146	java/lang/Exception:printStackTrace	()V
    //   487: goto -88 -> 399
    //
    // Exception table:
    //   from	to	target	type
    //   60	66	203	java/lang/SecurityException
    //   121	196	264	java/io/FileNotFoundException
    //   241	261	264	java/io/FileNotFoundException
    //   328	350	264	java/io/FileNotFoundException
    //   402	457	264	java/io/FileNotFoundException
    //   299	304	307	java/lang/Exception
    //   121	196	353	java/io/IOException
    //   241	261	353	java/io/IOException
    //   328	350	353	java/io/IOException
    //   402	457	353	java/io/IOException
    //   121	196	387	finally
    //   241	261	387	finally
    //   266	291	387	finally
    //   328	350	387	finally
    //   355	387	387	finally
    //   402	457	387	finally
    //   462	467	470	java/lang/Exception
    //   394	399	480	java/lang/Exception
  }

  public void interrupt()
  {
    this.g = true;
    super.interrupt();
  }

  public void run()
  {
    if (PRISActivityUpdate.a())
      PRISActivityUpdate.j(this.a).sendEmptyMessage(5);
    while (true)
    {
      BufferedInputStream localBufferedInputStream = null;
      try
      {
        localBufferedInputStream = c.a(this.b, this.d, this.a);
        if (localBufferedInputStream == null)
        {
          PRISActivityUpdate.j(this.a).sendEmptyMessage(3);
          PRISActivityUpdate.j(this.a).sendEmptyMessage(2131362013);
        }
        label307: 
        while (true)
        {
          return;
          PRISActivityUpdate.j(this.a).sendEmptyMessage(1);
          break;
          PRISActivityUpdate.j(this.a).sendEmptyMessage(2131362003);
          a(this.e, this.d);
          boolean bool1 = a(this.c, localBufferedInputStream, this.e, this.d);
          boolean bool2;
          if (!this.g)
          {
            PRISActivityUpdate.j(this.a).sendEmptyMessage(3);
            bool2 = PRISActivityUpdate.a(this.a, this.c, this.f);
            if (PRISActivityUpdate.b())
              b.e(PRISActivityUpdate.c(), "_md5 ==" + this.f);
            if ((!bool1) || (!bool2))
              break label246;
            PRISActivityUpdate.j(this.a).sendEmptyMessage(2131362004);
            PRISActivityUpdate.n(this.a);
          }
          while (true)
          {
            while (true)
            {
              if (localBufferedInputStream == null)
                break label307;
              try
              {
                localBufferedInputStream.close();
              }
              catch (IOException localIOException2)
              {
                localIOException2.printStackTrace();
              }
            }
            break;
            label246: if (!bool1)
              b.d(PRISActivityUpdate.c(), "save data failed when download package from net.");
            if (!bool2)
              b.d(PRISActivityUpdate.c(), "md5 check failed.");
            Message localMessage2 = PRISActivityUpdate.j(this.a).obtainMessage(2131362005, (int)this.d, -1);
            PRISActivityUpdate.j(this.a).sendMessage(localMessage2);
          }
        }
      }
      catch (IOException localIOException1)
      {
        while (true)
        {
          PRISActivityUpdate.j(this.a).sendEmptyMessage(3);
          if (((localIOException1 instanceof NoHttpResponseException)) || ((localIOException1 instanceof ConnectTimeoutException)) || ((localIOException1 instanceof SocketTimeoutException)))
          {
            PRISActivityUpdate.j(this.a).sendEmptyMessage(2131362021);
            continue;
          }
          if ((localIOException1 instanceof InterruptedIOException))
          {
            b.f(PRISActivityUpdate.c(), "A blocking I/O operation has been interrupted. Ignore this exception.");
            continue;
          }
          b.d(PRISActivityUpdate.c(), "Unknown IOException: " + localIOException1.toString());
          Message localMessage1 = PRISActivityUpdate.j(this.a).obtainMessage(2131362005, -1, -1);
          PRISActivityUpdate.j(this.a).sendMessage(localMessage1);
        }
      }
    }
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.pris.activity.da
 * JD-Core Version:    0.6.0
 */